/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fhv.itb.mst2955.server.persistence;

import fhv.itb.mst2955.client.model.UpdateObject;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * A server-side Contact Entity.
 */
@Entity
@Table(name = "Customer")
@NamedQueries({@NamedQuery(name = "Contact.findAll", query = "SELECT c FROM Contact c"), @NamedQuery(name = "Contact.findByAddressID", query = "SELECT c FROM Contact c WHERE c.addressID = :addressID"), @NamedQuery(name = "Contact.findByFirstName", query = "SELECT c FROM Contact c WHERE c.firstName = :firstName"), @NamedQuery(name = "Contact.findById", query = "SELECT c FROM Contact c WHERE c.id = :id"), @NamedQuery(name = "Contact.findByLastName", query = "SELECT c FROM Contact c WHERE c.lastName = :lastName")})
public class Contact implements Serializable, UpdateObject {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "addressID")
    private int addressID;
    @Column(name = "firstName")
    private String firstName;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "lastName")
    private String lastName;
    @Basic(optional = false)
    @Column(name = "versionNr")
    private int versionNr;


    public Contact() {
    }


    public Contact(Integer id) {
        this.id = id;
    }


    public Contact(Integer id, int addressID, String lastName) {
        this.id = id;
        this.addressID = addressID;
        this.lastName = lastName;
    }


    public int getAddressID() {
        return addressID;
    }


    public void setAddressID(int addressID) {
        this.addressID = addressID;
    }


    public String getFirstName() {
        return firstName;
    }


    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }


    public Integer getId() {
        return id;
    }


    public void setId(Integer id) {
        this.id = id;
    }


    public String getLastName() {
        return lastName;
    }


    public void setLastName(String lastName) {
        this.lastName = lastName;
    }


    public Integer getVersionNr() {
        return versionNr;
    }


    public void setVersionNr(Integer versionNr) {
        this.versionNr = versionNr;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }


    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contact)) {
            return false;
        }
        Contact other = (Contact) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }


    @Override
    public String toString() {
        return "fhv.itb.mst2955.server.persistence.Contact[id=" + id + "]";
    }

}
